import { HttpSrv } from 'lfun-bg-comp';
import { PageParams, PageResult, Result } from '../index';

export interface LogSearchParams {
  // operation_target_type: 'planning_school' | 'school' | 'campus' | 'teacher' | 'student';
  action_target_id?: any;
  // operater_account?: string;
  // operater_id?: number;
  // operation_module?: string;
  // operation_type?: string;
  change_module:
    | 'create_school'
    | 'close_school'
    | 'new_entry'
    | 'basic_info_change'
    | 'key_info_change'
    | 'family_info_change'
    | 'transfer'
    | 'transaction'
    | 'borrow'
    | 'retirement';
  process_instance_id: any;
}

export interface Log {
  operator: string;
  account: string;
  module: string;
  action_type: string;
  timestamp: any;
  change_data: any;
}

export const searchLogs = (params: LogSearchParams & PageParams): Result<PageResult<Log>> =>
  HttpSrv().get('/school/v1/system/page', { params });
